package com.service.gmall.feign.product;

import com.service.gmall.common.result.Result;
import com.service.gmall.model.product.SkuImage;
import com.service.gmall.model.product.SkuInfo;
import com.service.gmall.model.product.SpuSaleAttr;
import com.service.gmall.model.to.CategoryViewTo;
import com.service.gmall.model.to.SkuDetailsTo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author alpha
 * @className: SkuDetailFeignClient
 * @date 2022/8/26 23:10
 * @Description
 */
@FeignClient("service-product")
@RequestMapping("/api/inner/rpc/product")
public interface SkuDetailFeignClient {
//    @GetMapping("/getSkuDetails/{skuId}")
//    Result<SkuDetailsTo> getSkuDetails(@PathVariable("skuId") Long skuId);


    /**
     * 根据三级分类ID查询分类
     *
     * @param category3Id
     * @return
     */
    @GetMapping("/skuDetail/getCategoryView/{category3Id}")
    Result<CategoryViewTo> getCategoryView(@PathVariable("category3Id") Long category3Id);

    /**
     * 根据skuId查询sku基本信息
     *
     * @param skuId
     * @return
     */
    @GetMapping("/skuDetail/info/{skuId}")
    Result<SkuInfo> getSkuInfo(@PathVariable("skuId") Long skuId);

    /**
     * 获取sku的所有图片信息
     *
     * @param skuId
     * @return
     */
    @GetMapping("/skuDetail/images/{skuId}")
    Result<List<SkuImage>> getSkuImages(@PathVariable("skuId") Long skuId);

    /**
     * 根据skuId获取实时价格
     *
     * @param skuId
     * @return
     */
    @GetMapping("/skuDetail/price/{skuId}")
    Result<BigDecimal> getSkuRealTimePrice(@PathVariable("skuId") Long skuId);

    /**
     * 查询销售属名和值
     *
     * @param spuId
     * @param skuId
     * @return
     */
    @GetMapping("/skuDetail/getSpuSaleAttrList/{spuId}/{skuId}")
    Result<List<SpuSaleAttr>> getSpuSaleAttrList(@PathVariable("spuId") Long spuId,
                                                 @PathVariable("skuId") Long skuId);

    /**
     * 查询sku组合
     *
     * @param spuId
     * @return
     */
    @GetMapping("/skuDetail/getValuesSkuJson/{spuId}")
    Result<String> getValuesSkuJson(@PathVariable("spuId") Long spuId);
}
